<?php

namespace app\mall\ui\table;

use app\mall\enum\YesNoEnum;
use app\mall\model\MallUserLevelSetting;
use suframe\thinkAdmin\ui\table\TableInterface;

/**
 * 商城会员表格
 */
class MallUserTable extends TableInterface
{
    public function header()
    {
        return [
            'id'=> ['label' => 'ID', 'sort' => true, 'fixed' => 'left', 'width' => 80],
            'nickname'=> ['label' => '昵称'],
            'avatar'=> ['label' => '头像', 'type' => 'image', 'width' => 80],
            'level_text'=> ['label' => '等级', 'filter' => MallUserLevelSetting::buildLevelKeyValye(), 'field' => 'level_flag', 'width' => 80],
            'create_time'=> ['label' => '注册时间', 'width' => 160],
            'phone'=> ['label' => '手机号', 'width' => 120],
            'mail'=> ['label' => '邮箱'],
            'vip_expire_time'=> ['label' => 'vip到期时间', 'width' => 120],
            'money'=> ['label' => '账户余额', 'width' => 100],
            'point'=> ['label' => '积分', 'width' => 100],
            'enable_text'=> ['label' => '是否有效', 'filter' => YesNoEnum::toZhArray(), 'field' => 'enable'],
        ];
    }

    public function filters()
    {
        return [
            'nickname' => ['label' => '昵称', 'type' => 'text'],
        ];
    }
}